                            <div class="main">
                                <h3 class="title"><?=$clabel?> &raquo; <?=$mlabel?></h3>
                                <div class="formdiv">
                                    <form method="POST" id="frmAddUser">
                                        <table>
                                            <? if( isset($errors) ) {
                                               foreach($errors as $error) {
                                               ?>
                                            <tr>
                                                <td class="errormsg" colspan="3">
                                                    <?=$error?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }  ?>
                                            <? if( isset($successes) ) {
                                               foreach($successes as $success) {
                                               ?>
                                            <tr>
                                                <td class="successmsg" colspan="3">
                                                    <?=$success?>    
                                                </td>
                                            </tr>   
                                               <? 
                                               } 
                                            }
                                            ?>
                                            <tr>
                                                <td><label for="name">Name*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="name" value="<?=$postdata['name']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="roleid">Account Type*</label></td>
                                                <td>
                                                    <select class="text required" name="roleid">
                                                        <option value="">-- Select --</option>
                                                        <?
                                                            if(isset($rolelist) && is_array($rolelist) && count($rolelist) > 0) {
                            	                               foreach( $rolelist as $role ) {
                            	                                   $sel = '';
                            	                                   if(isset($postdata["roleid"]) && $role["roleid"]==$postdata["roleid"]) { $sel = "selected"; }
                                                        ?>
                                                                <option value="<?=$role["roleid"]?>" <?=$sel?>><?=$role["roletitle"]?></option>
                                                        <?
                            	                           }
                                                        }
                                                        ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="username">Username*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="username" value="<?=$postdata['username']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                        	<tr>
                                                <td><label for="password">Password*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="password" value="" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="password">Confirm Password*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="cpassword" value="" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="disabled">Disabled</label></td>
                                                <td>
                                                    <input value="1" class="required" <? if($postdata['disabled']=='1') echo "CHECKED=\"true\""; ?> type="radio" id="disabledtrue" name="disabled"/><label for="disabledtrue">True</label>
                                                    <input value="0" class="required" <? if($postdata['disabled']=='0') echo "CHECKED=\"true\""; ?> type="radio" id="disabledfalse" name="disabled"/><label for="disabledfalse">False</label>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="mobile">Mobile*</label></td>
                                                <td>
                                                    <input type="text" class="text required" name="mobile" value="<?=$postdata['mobile']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="email">Email*</label></td>
                                                <td>
                                                    <input type="text" class="text required email" name="email" value="<?=$postdata['email']?>" />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td><label for="address">Address</label></td>
                                                <td>
                                                    <textarea rows="3" cols="20" class="text" name="address"><?=$postdata['address']?></textarea>
                                                </td>
                                                <td></td>
                                            </tr>
                                        	<tr>
                                        		<td></td>
                                        		<td colspan="2">
                                                    <input class="button" type="submit" name="btnAddUser" value="Save" id="btnAddUser" />
                                                    <input class="button" type="reset" value="Cancel" id="btnreset" />
                                                </td>
                                        	</tr>
                                        </table>
                                	</form>
                                    <script language="javascript" type="text/javascript">
                                        if(typeof jQuery == 'undefined') {
                                            alert('Invalid Request');
                                            window.location = "/";
                                        }
                                        $(document).ready( function() {
                                            $("#frmAddUser").validate({
                                                errorPlacement: function(error, element) {
                                                    placeError(error, element);
                                                },
                                                submitHandler: function(form) {
                                                    var cui = $('#contenttabs .ui-tabs-panel:visible');                                                                                                        
                                               	    var jqxhr = $.post(
                                                        "/admin/adduser", 
                                                        $("#frmAddUser").serialize(), 
                                                        function (data) {
                                                            $(cui).html(data);
                                                        }
                                                    );
                                                    $(cui).html('<div id="loadingdiv"><div class="centerdiv"><strong>Processing</strong><br/><img src="/images/ajaxloader.gif" /></div></div>');
                                                }
                                            });
                                            
                                            $("#frmAddUser input[type='reset']").click( function() {
                                                $('#frmAddUser label.error').remove();
                                            });
                                        });
                                    </script>
                                 </div>
                            </div>           